package com.tengju.user.domain.model.sms;

import com.tengju.user.domain.shared.DomainException;
import com.tengju.user.domain.shared.DomainExceptionCode;
import lombok.Value;
import org.springframework.util.StringUtils;

@Value
public class ManMachineValidateData {

    /**
     * 流水号，一次完整验证流程的唯一标识
     */
    private String challenge;

    /**
     * 待校验的核心数据
     */
    private String validate;

    /**
     * 待校验的核心数据
     */
    private String secCode;


    public ManMachineValidateData(String challenge, String validate, String secCode) {
        if (StringUtils.isEmpty(challenge)) {
            throw DomainException.error(DomainExceptionCode.INVALID_DATA,"极验参数（challenge）为空");
        }
        if (StringUtils.isEmpty(validate)) {
            throw DomainException.error(DomainExceptionCode.INVALID_DATA,"极验参数（validate）为空");
        }
        if (StringUtils.isEmpty(secCode)) {
            throw DomainException.error(DomainExceptionCode.INVALID_DATA,"极验参数（secCode）为空");
        }
        this.challenge = challenge;
        this.validate = validate;
        this.secCode = secCode;
    }
}
